public class Medicine extends Item{
    private String type;

    public String getType() {
        return type;
    }
    public Medicine(String name,double price,int number,String type) {
        super(name, price, number);
        this.type = type;
    }

    @Override
    public String toString() {
        return "药品名："+this.getName()+"，类型："+type+"，单价："+this.getPrice()+"元"+"，数量"+this.getNumber()+"盒";
    }

    @Override
    public boolean equals(Object obj) {
        try {
            Medicine medicine=(Medicine) obj;
            return super.equals(medicine)&&this.type.equals(medicine.getType());
        }catch (ClassCastException e){
            return false;
        }

    }
}
